#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(void)
{
	int digit = 0;
	int number = 0;
	int other = -1;
	FILE *fp;
	char ch;

	fp = fopen("in.txt", "r");
	if (fp == NULL)
	{
		printf("File open error!\n");
		exit(0);
	}
	//打开文件并且判断是否打开成功，若打开失败，程序终止运行


	while (!feof (fp))
    //当文件指针指向文本内容末尾时，循环结束
	{
		
		ch = fgetc(fp);

		if ((ch >= 'a' && ch <= 'z') ||
			(ch >= 'A' && ch <= 'Z'))
		{
			digit++;
		}
		else if (ch >= '0' && ch <= '9')
		{
			number++;
		}
		else
		{
			other++;
		}

	//判断并统计文本中各种字符

	}

	if (fclose(fp))
	{
		printf("Can not close the file!\n");
		exit(0);
	}
	//关闭文件并且判断是否关闭成功，若关闭失败，程序终止运行

	printf("%d %d %d \n", digit, number, other);
    //输出统计结果
	return 0;
}




